package cn.edu.scau.cmi.wuzhenzhou.abstractFactory;

import java.net.URL;
import java.util.ResourceBundle;

import cn.edu.scau.cmi.wuzhenzhou.abstractFactory.domainAbstractClass.Meat;
import cn.edu.scau.cmi.wuzhenzhou.abstractFactory.factory.MeatFactory;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.Label;
import javafx.scene.control.TextArea;
import javafx.scene.control.TextField;

public class MyController implements Initializable{
	@FXML
	private TextField field1;
	@FXML
	private TextField field2;
	@FXML
	private Label label;
	@FXML
	private TextArea area;
	
	MeatFactory factory = null;
	
	@Override
	public void initialize(URL location, ResourceBundle resources) {
		// TODO Auto-generated method stub
		
	}
	
	public void estimate(ActionEvent event) {
		if(!field1.getText().equals("Aonong")&&!field1.getText().equals("Tianbang")&&!field1.getText().equals("Wens")){
			label.setText("sorry, your factory input is not correct");
			area.setText("");
		} else {
			switch (field2.getText()) {
			case "beef":
				factory = MeatFactory.getMeatFactory(field1.getText());
				area.setText(factory.createBeef().cook());
				break;
			case "pork":
				factory = MeatFactory.getMeatFactory(field1.getText());
				area.setText(factory.createPork().cook());
				break;
			case "chicken":
				factory = MeatFactory.getMeatFactory(field1.getText());
				area.setText(factory.createChicken().cook());
				break;
			default:
				label.setText("sorry, your meat input is not correct");
			}
		}
	}
	
	
	
}
